using System;
using System.Collections.Generic;

namespace CLELCore.Assembly
{
	public class StreamHeaders
	{
		private List<StreamHeader> _headers;

		public StreamHeaders()
		{
			_headers = new List<StreamHeader>();
		}
		
		public int Count
		{
			get
			{
				return _headers.Count;
			}
		}

		public StreamHeader this[int index]
		{
			get
			{
				if(index < 0 && index >= _headers.Count)
					return null;
				return _headers[index];
			}
			set
			{
				if(index >= 0 && index < _headers.Count)
					_headers[index] = value;
			}
		}

		public void Add(StreamHeader header)
		{
			_headers.Add(header);
		}

		public StreamHeader GetStreamHeader(String name)
		{
			if(_headers != null)
			{
				int i;
				int count = _headers.Count;
				for(i = 0;i < count;i++)
				{
					if(_headers[i].NameAsString.Equals(name))
						return _headers[i];
				}
			}
			return null;
		}
	}
}
